package hutoolTest;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;

import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

public class DateTest {

    public static void main(String[] args) {

//        System.out.println(DateUtil.offsetSecond(DateUtil.beginOfDay(new Date()), -1));


        DateTime endTime = DateUtil.endOfMonth(new Date());
        Date startTime = DateUtil.beginOfMonth(new DateTime().offset(DateField.MONTH, -11));
        System.out.println(DateUtil.rangeToList(startTime, endTime, DateField.MONTH));

        System.out.println(DateUtil.format(startTime, "yy-MM"));

        System.out.println(new DateTime().getField(DateField.YEAR));

        System.out.println((System.currentTimeMillis()+"").length());
        System.out.println((Long.MAX_VALUE+"").length());

        System.out.println(createInt20Id());
        System.out.println(new DateTime().getField(DateField.HOUR_OF_DAY));

        Set<Integer> hourSet = new HashSet<>();
        hourSet.add(16);
        System.out.println(hourSet.contains(new DateTime().getField(DateField.HOUR_OF_DAY)));


    }

    private static String createInt20Id() {
        return RandomUtil.randomInt(0, 999999)+""+System.currentTimeMillis();
    }


}
